import pandas as pd

# 创建示例数据
df1 = pd.DataFrame({
    '员工ID': [1, 2, 3, 4],
    '姓名': ['张三', '李四', '王五', '赵六'],
    '部门': ['技术', '销售', '技术', '人事']
})

df2 = pd.DataFrame({
    '员工ID': [1, 2, 3, 5],
    '薪资': [8000, 12000, 15000, 10000],
    '入职年份': [2020, 2019, 2018, 2021]
})

print("员工基本信息:")
print(df1)
print("\n员工薪资信息:")
print(df2)

# 内连接
inner_join = pd.merge(df1,df2,on= '员工ID', how= 'inner')
print("\n内连接结果:")
print(inner_join)

# 左连接
left_join = pd.merge(df1, df2 , on = '员工ID', how= 'left')
print("\n左连接结果:")
print(left_join)

# 外连接
outer_join = pd.merge(df1,df2, on ='员工ID', how = 'outer')
print("\n外连接结果:")
print(outer_join)

# 拼接数据
df3 = pd.DataFrame({
    '姓名': ['钱七', '孙八'],
    '部门': ['财务', '市场']
})

df4 = pd.DataFrame({
    '姓名': ['周九', '吴十'],
    '部门': ['运营', '客服']
})

concatenated = pd.concat([df3,df4], ignore_index =  True)
print("\n拼接结果:")
print(concatenated)
